/*
  FileName : X_UART.h

  Description : 
               TL16C554A, TL16C752 Rx and Tx data routings.

  Created on 2007.9.18 by ZZP.

  Revision History :


*/

#ifndef __X_UART_H__
#define __X_UART_H__


#include <std.h>


#define  TAX_HEAD_38   1
#define  TAX_HEAD_39   2


#define DBG_RX_SCI_A   1
#define DBG_RX_SCI_B   2
#define DBG_RX_GSMR    3
#define DBG_RX_YS      4
#define DBG_RX_MOB     5
#define DBG_RX_PUB     6


struct UART_BITS{
  Uns Gsmr_Rx : 1; //Bit 0
  Uns Gsmr_Tx : 1; //Bit 1
  Uns Mob_Rx  : 1; //Bit 2
  Uns Mob_Tx  : 1; //Bit 3
  Uns Tax_Rx  : 1; //Bit 4
  Uns rsvd1   : 1; //Bit 5
  Uns Gps_Rx  : 1; //Bit 6
  Uns Gps_Tx  : 1; //Bit 7
  Uns Gps_YSRx  : 1; //Bit 8
  Uns Gps_YSTx  : 1; //Bit 9
  Uns Gps_PubRx : 1; //Bit 10
  Uns Gps_PubTx : 1; //Bit 11
  Uns rsvd2     : 1; //Bit 12
  Uns rsvd3     : 1; //Bit 13
  Uns rsvd4     : 1; //Bit 14
  Uns rsvd5     : 1; //Bit 15
};

union UartSts_Reg{
  Uns all;
  struct UART_BITS bit;
};

extern union UartSts_Reg UartSts;

typedef struct{
  //
  Uns Port;
  Uns BufCntMask;
  Uns OneBufLen;
  Uns RemainLen;
  Uns *BufBaseAddr;
  //
  Uns Index;
  Uns HandleIndex;
  Uns *TxPtr;
  Uns TxTm;
  Uns TxFlag;
}UART_PORT_INFO, *pUART_PORT_INFO;

typedef struct{
  Uns Port;
  Uns StartF;
  Uns Cnt;
  Uns DLE;
  Uns *DestBaseAddr;
  Uns Index;
  Uns HandleIndex;
  Uns BufCntMask;
  Uns OneBufLen;
  Uns RxTm;
  Uns RxFlag;
}UART_RX_INFO, *pUART_RX_INFO;


struct UART_752_REGS{
  Uns Data;   // Rx and Tx data reg
  Uns IER;    // Interrupt enable reg
  Uns FCR;    // Interrupt identification Reg (Read) / FIFO Control reg(Write)
  Uns LCR;    // Line control reg (write)
  Uns MCR;    // Modem control reg (write)
  Uns LSR;    // Line Status reg (read)
  Uns MSR;    // Modem Status reg (read)
  Uns SPR;    // ScratchPad reg (Read/Write)
}; 

extern volatile struct UART_752_REGS TaxRegs;
extern volatile struct UART_752_REGS GpsRegs;
extern volatile struct UART_752_REGS YSRegs;
extern volatile struct UART_752_REGS MobRegs;


extern volatile Uns Tm_Tax38;
extern volatile Uns Tm_Tax39;
extern Uns Tax39Buf[40];
extern Uns Tax38Buf[32];

//GPS module variables:

extern Uns Sci_TxData(UART_PORT_INFO *PortInfo);
extern Uns Sci_RxData(UART_RX_INFO *RxPortInfo);
extern Uns UART_RxTaxData(void);
extern Uns UART_RxGpsData(Uns *Dest);
extern Uns UART_RxStdData(UART_RX_INFO *RxPortInfo);
extern void UART_TxData(UART_PORT_INFO *PortInfo);

extern void UART_Init(Uns GpsBaudRate);









#endif


//-------- End of File --------




